﻿<!--
Copyright © 1998, 2009, Oracle and/or its affiliates.  All rights reserved.
-->

<html>
<head><TITLE></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK href="../css/player.css" type=text/css rel=stylesheet>
<LINK href="../css/skin.css" type=text/css rel=stylesheet>

<script language="javascript" src="../js/resource.js"></script>
<script language="javascript" src="../js/browser1.js"></script>
<script language="javascript" src="../js/cookie.js"></script>
<script language="javascript" src="../js/help.js"></script>
<script language="javascript" src="../js/preferences.js"></script>
<script language="javascript" src="../js/noevents.js"></script>
<script language="javascript" src="../js/escape.js"></script>

<script>
	var isIE7=false;
</script>
<!--[if IE 7]>
<script>isIE7=true;</script>
<![endif]-->
	<!--[if IE 8]>
<script>isIE7=true;</script>
<![endif]-->

<script>
var arrRoles = new Array();
	
function ondemandRole(role) 
{
	arrRoles[arrRoles.length] = role;
}
</script>

<script language="javascript">

var Orig_Roles = new UserRolesClass();
Orig_Roles.Copy(UserRoles);

var bIsModified = false;

function GetOpener()
{
	var _opener;
	if (parent.opener)
		return parent.opener;

	return 0;
}

function SetModified(bModified)
{
	bIsModified = bModified;
}

function UpdateModified()
{
	SetModified(UserRoles.Compare(Orig_Roles));
}

function window_onload()
{
	SetNoEvents();
	document.title=R_my_roles;
	var _opener=GetOpener();
	if (_opener.GetAllRoles)
	{
		a=_opener.GetAllRoles();
		for (var i=0;i<a.length;i++)
		{
			ondemandRole(a[i]);
		}
		writeRoles();	
	}
	focus();
}

function writeRoles()
{
	var s="";
	for (i=0; i<arrRoles.length; i++) 
	{
		if (isRoleSelected(arrRoles[i])) 
		{ 
			s+=("<input id='role_" + i + "' type='checkbox' onClick='RoleSelect_onClick(" + i + ")' checked><a class='InstructText'>" + UnescapeRole(arrRoles[i]) + "</a><br>");
		}
		else 
		{
			s+=("<input id='role_" + i + "' type='checkbox' onClick='RoleSelect_onClick(" + i + ")'><a class='InstructText'>" + UnescapeRole(arrRoles[i]) + "</a><br>");
		}
	}
	document.all.rolelist.innerHTML=s;
}

</script>
		
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--

function DoApply()
{
	if (!bIsModified)
		return;

	SetModified(false);
	UserRoles.Filtering=(UserRoles.Roles.length!=0);

	UserRoles.StoreCookie();

	var _opener=GetOpener();
	if (_opener)
	{
		if (_opener.onUpdateRoles)
			_opener.onUpdateRoles();
	}

	Orig_Roles.Copy(UserRoles);
}

function Cancel_onclick()
{
	window.close();
}

function OK_onclick()
{
	DoApply();
	window.setTimeout("Cancel_onclick()",300);
}

function Help_onclick()
{
	onHelp("../");
}

function isRoleSelected(role) {
	for (var r=0; r<UserRoles.Roles.length; r++) {
		
		if (UserRoles.Roles[r]==role) {
			return true;
		}
		
	}
	return false;
}

function RoleSelect_onClick(Item) 
{
	var OldRoles = new UserRolesClass();
	OldRoles.Copy(UserRoles);
	UserRoles.Roles=new Array;
	for (var i=0; i<arrRoles.length; i++) 
	{
		//alert(document.roleform.elements["role_" + i].id);
		if (document.roleform.elements["role_" + i].checked) {
			UserRoles.Roles[UserRoles.Roles.length] = arrRoles[i];
		}
	}
	UpdateModified();
}

function UnescapeRole(roleName) {
	roleName=Gkod.Escape.MyUnEscape(roleName);
	// special character are encoded.
	// replace the $$ with a save string since the $ is used as other escape sequences
	var role = roleName;
	
	role = replaceString("<", "&lt;", role);
	role = replaceString(">", "&gt;", role);
	role = replaceString("\"", "&quot;", role);

	/*role = replaceString("$$", "<{dollar}>", role);
	role = replaceString("$t", "&", role);
	role = replaceString("$d", "&quot;", role);
	role = replaceString("$a", "'", role);
	role = replaceString("$q", "?", role);
	role = replaceString("$p", "+", role);
	role = replaceString("$e", "=", role);
	role = replaceString("$c", ":", role);
	role = replaceString("$s", ";", role);
	role = replaceString("$l", "&lt;", role);
	role = replaceString("$g", "&gt;", role);
	role = replaceString("$h", "/", role);
	role = replaceString("$b", "\\", role);
	role = replaceString("$n", "%", role);
	role = replaceString("<{dollar}>", "$", role);
	*/
	return role;
	
}

function replaceString(oldS,newS,fullS) {
// Replaces oldS with newS in the string fullS
   for (var i=0; i<fullS.length; i++) {
	   if (fullS.substring(i,i+oldS.length) == oldS) {
			fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length)
		}
	}
	return fullS
}

//-->
</script>
</head>

<script language="javascript">
	document.writeln('<body class="textWindows windowsBgColor" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bottommargin="0" rightmargin="0" onload="window_onload();">');
</script>

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="WIDTH: 100%">
	<tr>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
	</tr>
    <tr>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
		<td width="100%"><form name="roleform" action="">

			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="100%">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
						<td>

							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td><IMG height=4 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
								</tr>
								<tr>
									<td width="16"><IMG height=16 alt ="" src="../img/pref_ul.gif" width=16 border=0 ></td>
									<td nowrap valign="top"><a class="PrefTextHead">&nbsp;&nbsp;<script>document.write(R_roles_roles)</script>&nbsp;&nbsp;</a></td>
									<td background="../img/pref_top.gif" width="100%"><IMG height=16 alt ="" src="../img/pref_top.gif" width=16 border=0 ></td>
									<td width="16"><IMG height=16 alt ="" src="../img/pref_ur.gif" width=16 border=0 ></td>
								</tr>
							</table>

							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td valign="top" background="../img/pref_left.gif"><IMG height=16 alt ="" src="../img/pref_left.gif" width=16 border=0 ></td>
									<td width="100%" class="InstructText" style="padding: 3px 0px 6px 0px;"><script>document.write(R_roles_introtext)</script></td>
									<td valign="top" background="../img/pref_right.gif"><IMG height=16 alt ="" src="../img/pref_right.gif" width=16 border=0 ></td>
								</tr>
							</table>	

							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td valign="top" background="../img/pref_left.gif"><IMG height=16 alt ="" src="../img/pref_left.gif" width=16 border=0 ></td>
									<td colspan=2 width="100%">
										<div id="rolelist" style="OVERFLOW: auto; POSITION: relative; HEIGHT: 180px">
										</div>
									</td>
									<td valign="top" background="../img/pref_right.gif"><IMG height=16 alt ="" src="../img/pref_right.gif" width=16 border=0 ></td>
								</tr>
							</table>

							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td valign="top"><IMG height=16 alt ="" src="../img/pref_ll.gif" width=16 border=0 ></td>
									<td width="100%" background="../img/pref_bot.gif"><IMG height=16 alt ="" src="../img/pref_bot.gif" width=16 border=0 ></td>
									<td valign="top"><IMG height=16 alt ="" src="../img/pref_lr.gif" width=16 border=0 ></td>
								</tr>
							</table>
						</td>
						</tr>
					</table>
					</td>
				</tr>
			</table>

			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td><IMG height=6 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
				</tr>
				<tr>
					<td nowrap align="right"><IMG height=20 alt ="" src="../img/giftrk1.gif" width=1 border=0 >&nbsp; 
					<script>
						document.write('<input type="button" style="margin-left: 5px;"');
						if (document.all)
							if (isIE7==true)
								document.write(' class="InstructTextButtonIE7"');
							else
								document.write(' class="InstructTextButtonIE"');
						else
							document.write(' class="InstructTextButtonFF"');
						document.write(' name="OK" value="'+R_roles_OK+'" language="javascript" onclick="return OK_onclick()">');
						
						document.write('<input type="button" style="margin-left: 5px;"');
						if (document.all)
							if (isIE7==true)
								document.write(' class="InstructTextButtonIE7"');
							else
								document.write(' class="InstructTextButtonIE"');
						else
							document.write(' class="InstructTextButtonFF"');
						document.write(' name="Cancel" value="'+R_roles_cancel+'" language="javascript" onclick="return Cancel_onclick()">');
						
						document.write('<input type="button" style="margin-left: 5px;"');
						if (document.all)
							if (isIE7==true)
								document.write(' class="InstructTextButtonIE7"');
							else
								document.write(' class="InstructTextButtonIE"');
						else
							document.write(' class="InstructTextButtonFF"');
						document.write(' name="Help" value="'+R_roles_help+'" language="javascript" onclick="return Help_onclick()">');
					</script>
					<IMG height=4 alt ="" src="../img/giftrk1.gif" width=2 border=0 >
					</td>
				</tr>
			</table>

		</form>
		</td>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
	</tr>
	<tr>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
		<td><IMG height=10 alt ="" src="../img/giftrk1.gif" width=10 border=0 ></td>
	</tr>
</table>
</BODY>
</html>
